package cqupt.spark_log.main;

import cqupt.spark_log.info.BanchInfo;
import cqupt.spark_log.info.EnergyInfo;
import cqupt.spark_log.info.TableInfo;
import cqupt.spark_log.utils.Utils;

/**
 * 从这里开始分析日志
 * 生成jar包的会用到，其他入口也会用到
 * @author TomWang
 *
 */
public class Main {

	public static void main(String[] args) {
		// 分析基準測試日誌
		BanchInfo banchInfo = new BanchInfo();
		banchInfo.exe();
		Utils.printMap(banchInfo.getExecutors());
		Utils.printMap(banchInfo.getJobs());
		Utils.printMap(banchInfo.getStages());
		Utils.printMap(banchInfo.getTasks());
		// 计算能耗
		EnergyInfo energyInfo = new EnergyInfo(banchInfo);
		energyInfo.run();
		System.out.println("处理结束");
		Utils.printMap(banchInfo.getTasks());
		double energy = energyInfo.calculate();
		System.out.println("app的能耗为"+energy);
		System.out.println("運行時長为"+banchInfo.getMakeSpan()+"ms");
		System.out.println("整体運行時長为"+banchInfo.getALLMakeSpan()+"ms");
		//輸出策略表
		TableInfo tableInfo = new TableInfo(banchInfo);
		tableInfo.saveTable();
		System.out.println("输出策略表結束");
	}
}
